pkgname=iozone
pkgver=3
pkgrel=479
pkgdesc="A filesystem benchmark tool"
arch=('i386' 'x86_64')
url="http://www.iozone.org/"
license=('custom')
depends=('')
optdepends=('gnuplot: for generating graph reports')
install=$pkgname.install
source=("http://www.${pkgname}.org/src/current/${pkgname}${pkgver}_${pkgrel}.tar")
sha512sums=('cf8095dd9c9938fb0c1dc0aefc093a1be147634e8f2ffb2cd3b05409c8d220085816a44fb8821c9c7df8622d23ba1fb5d8342259cdd7fac7d36b1bc1fdc0ded4')

build() {
	cd "${srcdir}/${pkgname}${pkgver}_${pkgrel}/src/current"

	[[ "${CARCH}" == 'x86_64' ]] && TARGET='-AMD64'
	make linux${TARGET} CFLAGS="${CFLAGS} -fcommon"
}

package() {
	cd "${srcdir}/${pkgname}${pkgver}_${pkgrel}/src/current"

	_examples=/usr/share/doc/iozone3/examples

	install -Dm755 iozone ${pkgdir}/usr/bin/iozone
	install -Dm755 fileop ${pkgdir}/usr/bin/fileop
	install -Dm755 pit_server ${pkgdir}/usr/bin/pit_server
	install -Dm644 ../../docs/$pkgname.1 ${pkgdir}/usr/share/man/man1/$pkgname.1

	for i in gnuplotps.dem gnu3d.dem gnuplot.dem Gnuplot.txt client_list; do
		install -Dm644 $i ${pkgdir}/$_examples/$i
	done

	for i in Generate_Graphs iozone_visualizer.pl gengnuplot.sh report.pl; do
		install -Dm755 $i ${pkgdir}/$_examples/$i
	done
}
